﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using CubicFWNet.Data.Models;
using CubicFWNet.Data.SystemManager;
using CubicFWNet.Data.ViewModal;


namespace CubicFWNet.Application.SystemManager
{
    public class InventoryChangeApp
    {
        private readonly InventoryChangeRepository _inventoryChangeRepository = new InventoryChangeRepository();

        public IEnumerable<InventoryChangeView> GetList(string name, DateTime start, DateTime end)
        {
            return _inventoryChangeRepository.GetList(name, start, end).OrderByDescending(a => a.CreateTime);
        }
        public InventoryChange Get(Guid id)
        {
            return _inventoryChangeRepository.IQueryable(a => a.Id == id).FirstOrDefault();
        }
        public int Add(InventoryChange inv)
        {
            return _inventoryChangeRepository.Insert(inv);
        }

        public int Update(InventoryChange inv)
        {
            return _inventoryChangeRepository.Update(inv);
        }
    }
}
